{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "sub = pd.read_csv('sample submission.csv')\n",
    "sub1 = pd.read_csv('blend_v1f.csv')    # lb : 1.6709681834762957\n",
    "sub2 = pd.read_csv('MH20_FastAI_v2d.csv') # lb : 1.669271790926284"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>1267.000000</td>\n",
       "      <td>1267.000000</td>\n",
       "      <td>1267.000000</td>\n",
       "      <td>1267.000000</td>\n",
       "      <td>1267.000000</td>\n",
       "      <td>1267.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>0.156997</td>\n",
       "      <td>0.177870</td>\n",
       "      <td>0.217458</td>\n",
       "      <td>0.209064</td>\n",
       "      <td>0.071173</td>\n",
       "      <td>0.167439</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>0.051896</td>\n",
       "      <td>0.054466</td>\n",
       "      <td>0.035186</td>\n",
       "      <td>0.074145</td>\n",
       "      <td>0.055220</td>\n",
       "      <td>0.065883</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>0.048688</td>\n",
       "      <td>0.055671</td>\n",
       "      <td>0.103150</td>\n",
       "      <td>0.044515</td>\n",
       "      <td>0.010290</td>\n",
       "      <td>0.040531</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>0.116381</td>\n",
       "      <td>0.134363</td>\n",
       "      <td>0.193668</td>\n",
       "      <td>0.152206</td>\n",
       "      <td>0.031043</td>\n",
       "      <td>0.117583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>0.150721</td>\n",
       "      <td>0.176249</td>\n",
       "      <td>0.216950</td>\n",
       "      <td>0.199068</td>\n",
       "      <td>0.056456</td>\n",
       "      <td>0.159916</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>0.189666</td>\n",
       "      <td>0.219449</td>\n",
       "      <td>0.241391</td>\n",
       "      <td>0.264497</td>\n",
       "      <td>0.091631</td>\n",
       "      <td>0.210156</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>0.327776</td>\n",
       "      <td>0.342469</td>\n",
       "      <td>0.315964</td>\n",
       "      <td>0.416455</td>\n",
       "      <td>0.463691</td>\n",
       "      <td>0.439737</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 0            1            2            3            4  \\\n",
       "count  1267.000000  1267.000000  1267.000000  1267.000000  1267.000000   \n",
       "mean      0.156997     0.177870     0.217458     0.209064     0.071173   \n",
       "std       0.051896     0.054466     0.035186     0.074145     0.055220   \n",
       "min       0.048688     0.055671     0.103150     0.044515     0.010290   \n",
       "25%       0.116381     0.134363     0.193668     0.152206     0.031043   \n",
       "50%       0.150721     0.176249     0.216950     0.199068     0.056456   \n",
       "75%       0.189666     0.219449     0.241391     0.264497     0.091631   \n",
       "max       0.327776     0.342469     0.315964     0.416455     0.463691   \n",
       "\n",
       "                 5  \n",
       "count  1267.000000  \n",
       "mean      0.167439  \n",
       "std       0.065883  \n",
       "min       0.040531  \n",
       "25%       0.117583  \n",
       "50%       0.159916  \n",
       "75%       0.210156  \n",
       "max       0.439737  "
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sub1.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>1267.000000</td>\n",
       "      <td>1267.000000</td>\n",
       "      <td>1267.000000</td>\n",
       "      <td>1267.000000</td>\n",
       "      <td>1267.000000</td>\n",
       "      <td>1267.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>0.148097</td>\n",
       "      <td>0.165343</td>\n",
       "      <td>0.235676</td>\n",
       "      <td>0.216950</td>\n",
       "      <td>0.055687</td>\n",
       "      <td>0.178249</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>0.059333</td>\n",
       "      <td>0.067998</td>\n",
       "      <td>0.055963</td>\n",
       "      <td>0.076056</td>\n",
       "      <td>0.054022</td>\n",
       "      <td>0.079338</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>0.033923</td>\n",
       "      <td>0.040243</td>\n",
       "      <td>0.071848</td>\n",
       "      <td>0.014927</td>\n",
       "      <td>0.002580</td>\n",
       "      <td>0.005969</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>0.103805</td>\n",
       "      <td>0.114366</td>\n",
       "      <td>0.198205</td>\n",
       "      <td>0.161599</td>\n",
       "      <td>0.019678</td>\n",
       "      <td>0.117852</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>0.144837</td>\n",
       "      <td>0.155475</td>\n",
       "      <td>0.226422</td>\n",
       "      <td>0.210871</td>\n",
       "      <td>0.039923</td>\n",
       "      <td>0.172606</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>0.184257</td>\n",
       "      <td>0.208244</td>\n",
       "      <td>0.262318</td>\n",
       "      <td>0.274702</td>\n",
       "      <td>0.075427</td>\n",
       "      <td>0.236196</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>0.435589</td>\n",
       "      <td>0.483786</td>\n",
       "      <td>0.474071</td>\n",
       "      <td>0.442819</td>\n",
       "      <td>0.491675</td>\n",
       "      <td>0.448781</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 0            1            2            3            4  \\\n",
       "count  1267.000000  1267.000000  1267.000000  1267.000000  1267.000000   \n",
       "mean      0.148097     0.165343     0.235676     0.216950     0.055687   \n",
       "std       0.059333     0.067998     0.055963     0.076056     0.054022   \n",
       "min       0.033923     0.040243     0.071848     0.014927     0.002580   \n",
       "25%       0.103805     0.114366     0.198205     0.161599     0.019678   \n",
       "50%       0.144837     0.155475     0.226422     0.210871     0.039923   \n",
       "75%       0.184257     0.208244     0.262318     0.274702     0.075427   \n",
       "max       0.435589     0.483786     0.474071     0.442819     0.491675   \n",
       "\n",
       "                 5  \n",
       "count  1267.000000  \n",
       "mean      0.178249  \n",
       "std       0.079338  \n",
       "min       0.005969  \n",
       "25%       0.117852  \n",
       "50%       0.172606  \n",
       "75%       0.236196  \n",
       "max       0.448781  "
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sub2.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>1267.000000</td>\n",
       "      <td>1267.000000</td>\n",
       "      <td>1267.000000</td>\n",
       "      <td>1267.000000</td>\n",
       "      <td>1267.000000</td>\n",
       "      <td>1267.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>0.153882</td>\n",
       "      <td>0.173485</td>\n",
       "      <td>0.223834</td>\n",
       "      <td>0.211824</td>\n",
       "      <td>0.065753</td>\n",
       "      <td>0.171222</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>0.052365</td>\n",
       "      <td>0.056262</td>\n",
       "      <td>0.039292</td>\n",
       "      <td>0.072501</td>\n",
       "      <td>0.052533</td>\n",
       "      <td>0.067426</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>0.048624</td>\n",
       "      <td>0.059314</td>\n",
       "      <td>0.096229</td>\n",
       "      <td>0.034159</td>\n",
       "      <td>0.007618</td>\n",
       "      <td>0.029189</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>0.112970</td>\n",
       "      <td>0.128747</td>\n",
       "      <td>0.198457</td>\n",
       "      <td>0.157525</td>\n",
       "      <td>0.028501</td>\n",
       "      <td>0.119760</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>0.148965</td>\n",
       "      <td>0.168900</td>\n",
       "      <td>0.219336</td>\n",
       "      <td>0.202808</td>\n",
       "      <td>0.051768</td>\n",
       "      <td>0.163040</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>0.187728</td>\n",
       "      <td>0.215659</td>\n",
       "      <td>0.246274</td>\n",
       "      <td>0.268370</td>\n",
       "      <td>0.084773</td>\n",
       "      <td>0.217511</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>0.340201</td>\n",
       "      <td>0.383314</td>\n",
       "      <td>0.357762</td>\n",
       "      <td>0.413610</td>\n",
       "      <td>0.452065</td>\n",
       "      <td>0.412940</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 0            1            2            3            4  \\\n",
       "count  1267.000000  1267.000000  1267.000000  1267.000000  1267.000000   \n",
       "mean      0.153882     0.173485     0.223834     0.211824     0.065753   \n",
       "std       0.052365     0.056262     0.039292     0.072501     0.052533   \n",
       "min       0.048624     0.059314     0.096229     0.034159     0.007618   \n",
       "25%       0.112970     0.128747     0.198457     0.157525     0.028501   \n",
       "50%       0.148965     0.168900     0.219336     0.202808     0.051768   \n",
       "75%       0.187728     0.215659     0.246274     0.268370     0.084773   \n",
       "max       0.340201     0.383314     0.357762     0.413610     0.452065   \n",
       "\n",
       "                 5  \n",
       "count  1267.000000  \n",
       "mean      0.171222  \n",
       "std       0.067426  \n",
       "min       0.029189  \n",
       "25%       0.119760  \n",
       "50%       0.163040  \n",
       "75%       0.217511  \n",
       "max       0.412940  "
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "for i in sub.columns:\n",
    "    sub[i] = .65 * sub1[i] + .35 * sub2[i]\n",
    "\n",
    "sub.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "sub.to_csv('Blend_v4d.csv', index = False)# 65/35 lb : 1.6673069762554185"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
